/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.edu.amu.wmi.kino.visualjavafx.model.generators;

import java.awt.Color;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import pl.edu.amu.wmi.kino.visualjavafx.model.animation.interpolators.Linear;
import pl.edu.amu.wmi.kino.visualjavafx.model.animation.transformations.Rotation;
import pl.edu.amu.wmi.kino.visualjavafx.model.animation.transformations.Translation;
import pl.edu.amu.wmi.kino.visualjavafx.model.api.ModelChangeEvent;
import pl.edu.amu.wmi.kino.visualjavafx.model.api.ModelChangeListener;
import pl.edu.amu.wmi.kino.visualjavafx.model.api.VisualJavaFxModelProvider;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.Application;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.Canvas;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.shapes.Circle;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.Frame;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.shapes.Elipse;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.shapes.Rectangle;

/**
 *
 * @author psychollek
 */
public class ModelGenerator implements VisualJavaFxModelProvider{
    
    public Application generateModel(){
        Application app = new Application();
        ArrayList<Frame> frames = app.getFrames();

        Rectangle r = ModelRectangleGenerator.generateRectangle(200, 150, 50, 50, Color.BLACK,
                Color.BLUE, 3);
        Circle c = ModelCircleGenerator.generateCircle(500, 300, 100, Color.RED, Color.GREEN,
                5);
        Elipse e = ModelEllipseGenerator.generateElipse(800, 400, 150, 50, Color.PINK, Color.YELLOW, 20);

        Canvas can = ModelCanvasGenerator.generateCanvas(Color.BLACK);

        Translation tt = ModelTranslationGenerator.generateTranslation(100, 200, new Linear(), new Linear());
        Rotation tr = ModelRotationGenerator.generateRotation(135, e.getHCenterDelta(), e.getVCenterDelta(), new Linear());

        c.getTimeline().getKeyFrameAt(5).getTransformations().add(tt);
        r.getTimeline().getKeyFrameAt(3).getTransformations().add(tr);
        e.getTimeline().getKeyFrameAt(5).getTransformations().add(tr);
        e.getTimeline().getKeyFrameAt(2).getTransformations().add(tr);
        e.getTimeline().getKeyFrameAt(5).getTransformations().add(tt);


        can.getContent().add(c);
        can.getContent().add(r);
        can.getContent().add(e);

        Frame f = ModelFrameGenerator.generateFrame(1000, 800, 50, 50, "test", can);
        frames.add(f);

        return app;

    }


    @Override
    public Application getModel() {
        return generateModel();
    }

    @Override
    public void addModelChangeListener(ModelChangeListener listener) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void notifyModelChange(ModelChangeEvent evt) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void removeModelChangeListener(ModelChangeListener listener) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
